local toggle_modes = { 'n' }
local mappings = {
  { toggle_modes, '<leader>jt', function()
    local Terminal = require('toggleterm.terminal').Terminal
    local lazygit  = Terminal:new({ cmd = "npx jest " .. vim.fn.expand('%'), hidden = true })
    lazygit:toggle()
  end,
    {
      desc =
      'javascript run jest test'
    }
  },

  { toggle_modes, '<leader>jn', function()
    local Terminal = require('toggleterm.terminal').Terminal
    local lazygit  = Terminal:new({ cmd = "node", hidden = true })
    lazygit:toggle()
  end,
    {
      desc =
      'javascript run node repl'
    }
  },
  { toggle_modes, '<leader>h', function() require("nvterm.terminal").toggle('horizontal') end,
    {
      desc =
      'toggle horizontal terminal'
    } },
  { toggle_modes, "<leader>'", function() require("nvterm.terminal").toggle('horizontal') end,
    {
      desc =
      'toggle horizontal terminal'
    } },
  { toggle_modes, '<leader>v', function() require("nvterm.terminal").toggle('vertical') end,
    {
      desc =
      'toggle vertical terminal'
    } },
  { toggle_modes, '<leader>i', function() require("nvterm.terminal").toggle('float') end,
    {
      desc =
      'toggle float terminal'
    } },
}
local opts = { noremap = true, silent = true }
for _, mapping in ipairs(mappings) do
  vim.keymap.set(mapping[1], mapping[2], mapping[3], vim.tbl_extend('force', opts, mapping[4]))
end


return {
  "akinsho/toggleterm.nvim",
  { "zbirenbaum/nvterm", opts = {} },
  {
    "aserowy/tmux.nvim",
    opts = { enable = true }
  }
}
